package com.dyh.scdemo.fconsumer.controller;


import com.dyh.scdemo.fconsumer.impor.ImporHelloApi;
import com.dyh.scdemo.fprovider.api.HelloApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
@Author=Joey Wheeler
@Date=2020/10/28 11:33
*/
@RestController
@RequestMapping("/CallProvicerController")
public class CallProvicerController  {

    @Autowired
    ImporHelloApi imporHelloApi;

    /*
    @Value("${myname}")
    public String myname;
    */

//
//    @Value("${name}")
//    public String name;


//    @RequestMapping("/name")
//    public String name(){
//       // return String.format("myname=%s name=%s",myname,name);
//        return String.format("name=%s",name);
//    }


    @RequestMapping("/error")
    public String error(){
        return imporHelloApi.error();
    }



    @RequestMapping("/hello/{msg}")
    public String hello(@PathVariable String msg){
        return imporHelloApi.hello(msg);
    }

    @RequestMapping("/timeout/{n}")
    public String timeout(@PathVariable int n){
        return imporHelloApi.timeout(n);
    }
}
